package com.alan.service.impl;

import com.alan.repository.AdminRepository;
import com.alan.repository.StudentRepository;
import com.alan.repository.TeacherRepository;
import com.alan.repository.impl.AdminRepsitoryImpl;
import com.alan.repository.impl.StudentRepositoryImpl;
import com.alan.repository.impl.TeacherRepositoryImpl;
import com.alan.service.LoginService;

public class LoginServiceImpl implements LoginService {
    private StudentRepository studentRepository = new StudentRepositoryImpl();
    private TeacherRepository teacherRepository = new TeacherRepositoryImpl();
    private AdminRepository adminRepository = new AdminRepsitoryImpl();

    @Override
    public Object login(String username, String password, String identify) {
        Object object = null;
        switch (identify) {
            case "student":
                object = studentRepository.login(username, password);
                break;
            case "teacher":
                object = teacherRepository.login(username, password);
                break;
            case "admin":
                object = adminRepository.login(username, password);
                break;
        }

        return object;
    }
}
